package com.project.study.farming.base.manager;

import com.project.study.farming.base.entity.dto.*;
import com.project.study.farming.base.mapper.MainPageMapper;
import com.project.study.farming.common.utils.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户manager
 * @since 2020-04-25
 */
@Service
public class ConsumerManager {



    @Autowired
    private MainPageMapper mainPageMapper;

    /**
     * 查询农产品信息
     * @return 农产品信息
     */
    public List<CropsDto> getCrops() {
        return this.mainPageMapper.getCrops(CommonUtil.getUser().getId());
    }

    public List<MainPageDto> getMainPage(){
        return this.mainPageMapper.getMainPage(CommonUtil.getUser().getId());
    }

    /**
     * 查询农产品种类
     * @return 农产品种类
     */
    public List<CropsTypeDto> getTypes() {
        return this.mainPageMapper.getTypes();
    }

    public List<ServicePageDto> servicePage(Integer auditStatus, Integer cropId, Integer type){
        return this.mainPageMapper.servicePage(auditStatus, cropId, type, CommonUtil.getUser().getId());
    }

    public List<PlantPageDto> plantPage(Integer id, Integer cropId, Integer plantStatus){
        return this.mainPageMapper.plantPage(id, cropId, plantStatus);
    }

    public List<ControlDto> controlPage(Integer cropId, Integer areaId){
        return this.mainPageMapper.controlPage(CommonUtil.getUser().getId(), cropId, areaId);
    }
}
